package domain;

import java.util.LinkedList;
import java.util.List;

public class Busqueda {
	
	private Integer userId;
	private String key = "";
	private List<Manifestacion> searched;
	private Manifestacion currentView;
	
	public Busqueda(String key, Integer userId){
		try{
			this.searched = new LinkedList<Manifestacion>();
			this.userId = userId;
			this.key = key;
		} catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public List<Manifestacion> getSearched() {
		return searched;
	}

	public void setSearched(List<Manifestacion> searched) {
		this.searched = searched;
	}

	public Manifestacion getCurrentView() {
		if(this.currentView.equals("") && !this.searched.isEmpty())
			currentView = this.searched.get(0);
		
		return currentView;
	}

	public void setCurrentView(Manifestacion currentView) {
		if(!this.searched.contains(currentView) && !this.searched.isEmpty() )
			this.currentView = this.searched.get(0);
		
		this.currentView = currentView;
	}
}
